﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IsmsExplorer.Model.Documents;
using IsmsExplorer.Infrastructure.Helper;
using IsmsExplorer.Infrastructure.EntityFactoryFramework;

namespace IsmsExplorer.Infrastructure.Repositories.Documents {
    internal class IsmsSpecificDocumentationFactory : IEntityFactory<IsmsSpecificDocumentation> {
        internal static class FieldNames {
            public const string ProjectID = "ProjectID";
            public const string DocumentID = "DocumentID";
            public const string DocumentTypeID = "DocumentTypeID";
            public const string Description = "Description";
        } // end internal static class FieldNames

        public IsmsSpecificDocumentation BuildEntity(System.Data.IDataReader reader) {
            // The actual associated documents (document links) will be retrieved separately.
            return new IsmsSpecificDocumentation() {
                ProjectID = DataHelper.GetInteger(reader[FieldNames.ProjectID]),
                DocumentTypeID = DataHelper.GetInteger(reader[FieldNames.DocumentTypeID]),
                Description = DataHelper.GetString(reader[FieldNames.Description])
            };
        }
    }
}
